// algowala.cc
//
// by jag bot
//

#include <iostream>
#include <iomanip>
#include <iterator>
#include <fstream>
#include <string>
#include <list>
#include "chrono.h"
#include "stock.h"
#include "ansi_color_codes.h"
using namespace std;

int main (int argc, char* argv[]) {

  chrono clk; // our nanosecond precise clock!
  
  list<stock> stocks; // list of stocks
  
  // add a couple stocks
  //
  // name, price, volatility, how many times to update, in how many seconds
  stock rbs ("RBS", 65, 5, 1, 1); // RBS, 65p, price moves by 5p every change, change once, every second
  stock barclays ("BARC", 220, 10, 1, 5); // BARC, 220p, price moves by 10p every change, change once, every 5 seconds 
  
  stocks.push_back (rbs);
  stocks.push_back (barclays);
  
  clk.reset (); // get ready to tick
  
  while (1) {
    for (list<stock>::iterator i = stocks.begin (), j = stocks.end (); i != j; ++i) { // run thru list of stocks and tick each
      stock& si = *i;
      si.tick (clk.secs);
    }
    clk.tick ();
  }
  return 0;

}
